|
|
|
|
|
|
|
Figure 22.6
To create a linked object at designtime, choose
a filename and select the Link check box. |
|
|
|
|
|
|
|
|
You can also create a linked object at runtime by using the CreateLink method, as in the following example: |
|
|
|
|
|
|
|
|
OLE1.CreateLink "C:\Windows\Pinstripe.BMP" |
|
|
|
|
|
|
|
|
When you're using linked objects, changes you make to the object's file are reflected in your program. Also, if you edit the linked object in the program, changes are made to the source file. How the object is updated is controlled by the UpdateOptions property, which has the following values: |
|
|
|
|
| | | |
|
|
|
|
The object is updated automatically when changes are made to the source file (default). |
|
|
|
| | |
|
|
|
|
The object is updated when the source file is saved from the source application. |
|
|
|
| | |
|
|
|
|
The object is updated when the Update method is called. |
|
|
|
|
|
|
|
|
|
|
In the example from the previous section, changing the UpdateOptions property determines when the changes made to the Paintbrush drawing are reflected in the OLE control. |
|
|
|
|
|
|
|
|
In this chapter, you learned about using OLE to control other applications and embed objects in a program. Although the focus was on specific products, keep in mind that you may have other non-Microsoft products with their own type libraries installed on your system. To build on the material discussed in this chapter, refer to the following chapters: |
|
|
|
|
|
|
|
|
To learn more about classes and collections, see Chapter 16, "Classes: Reusable Components." |
|
|
|
|
|
|
|
|
To find out how to include data in your reports, see Chapter 24, "Database Basics." |
|
|
|
|
|